<%--
  Created by IntelliJ IDEA.
  User: taohj
  Date: 2014/6/29
  Time: 18:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<c:set var="menu" value="none" scope="request"/>
<c:set var="dashboardMenuTag" value="myorg" scope="request"/>

<!Doctype html>
<html>
<head>
    <base href="<%=basePath%>">
    <title>政府数据开放平台</title>
    <jsp:include page="../../../commons/include.jsp"/>


    <script>
        $(function () {
            $(".pagination li").on('click', function () {
                $('form input[name="page"]').val($(this).attr("page"));
                $("form").submit();
            });


            $(".table tbody tr").each(function (index) {

                var dataset = $(this).attr('dataset');

                $(this).find("td:last>ul>li:first").on('click', function () {
                    location.href = '/front/my/org/dataset/modifyV?id=' + dataset;
                });

                $(this).find("td:last>ul>li:last").on('click', function () {
                    if (confirm("确定要删除吗？")) {
                        var appid = $(this).attr('appid');
                        location.href = '/front/my/org/dataset/remove?id=' + dataset;
                    }
                });
            });


            $("form select").on('change', function () {
                $("form").submit();
            });


        });
    </script>


</head>
<body>


<div class="main">

    <jsp:include page="../../../commons/top.jsp"/>

    <jsp:include page="../../../commons/dashboardMenu.jsp"/>




        <div>
            <div class="left">
                <ul>
                    <li href="/front/my/org/list" >机构管理</li>
                    <li href="/front/my/org/dataset/list" class="active">数据集管理</li>
                    <li href="/front/my/org/dataset/data/list">数据管理</li>
                </ul>
            </div>
            <div class="right">
                <div style=" min-height: 80px">
                    <div style="height: 40px; width: 100%;padding: 20px 0px 20px 20px;">
                        <input type="button" style="font-size: 14px;padding: 4px;" onclick="location.href='/front/my/org/dataset/createV?org=${requestScope.org}'"
                               value="新增">
                    </div>


                    <div>
                        <form action="/front/my/org/dataset/list" style="padding-left: 30px">
                            <input type="hidden" name="page">
                            <table>
                                <tr>
                                    <td width="40">名称：</td>
                                    <td><input type="text" name="name" style="min-width: 100px" value="${requestScope.result.pageResult.t.name}"></td>
                                    <td width="10"></td>
                                    <td>主题：</td>
                                    <td>
                                        <select name="theme" dataSync='true' syncType='datatheme'  selectValue="${requestScope.result.pageResult.t.theme.id}"  style="min-width: 100px">
                                            <option value="">请选择</option>
                                        </select>
                                    </td>
                                    <td width="10"></td>
                                    <td>机构：</td>
                                    <td>
                                        <select name="org" dataSync='true' syncType='org'  selectValue="${requestScope.result.pageResult.t.org.id}"  style="min-width: 100px">
                                            <option value="">请选择</option>
                                        </select>
                                    </td>
                                    <td width="20"></td>

                                    <td><input type="submit" value="搜索"></td>
                                </tr>
                            </table>

                        </form>

                    </div>



                </div>


                <div style="padding: 20px 20px">
                    <span style="font-size: 16px;font-weight: bold;">共找到条${requestScope.result.pageResult.total}记录</span>
                </div>


                <div style="padding-left: 30px;min-height: 320px">
                    <table width="96%" class="table">

                        <thead>
                        <tr>
                            <td width="60">序号 </td>
                            <td width="100">名称</td>
                            <td width="100">机构</td>
                            <td width="100">主题</td>
                            <td width="50">状态 </td>
                            <td width="150">创建时间</td>
                            <td width="100">操作</td>
                        </tr>
                        </thead>


                        <tbody>
                        <c:choose>
                            <c:when test="${not empty requestScope.result.pageResult.rows}">
                                <c:forEach items="${requestScope.result.pageResult.rows}" var="dataset" varStatus="status">
                                    <tr dataset="${dataset.id}">
                                        <td >${status.count+requestScope.result.pageResult.page*requestScope.result.pageResult.size-requestScope.result.pageResult.size}</td>
                                        <td>
                                            <a href="/front/my/org/dataset/data/list?dataset=${dataset.id}">${dataset.name}</a>
                                        </td>
                                        <td>${dataset.org.name}</td>
                                        <td>${dataset.theme.name}</td>
                                        <td>${dataset.status.name}</td>
                                        <td>

                                            <jsp:useBean id="now" class="java.util.Date"></jsp:useBean>
                                            <fmt:formatDate value="${now}" pattern="yyyy-MM-dd HH:mm:ss"/>
                                                <%--${dataset.createTime}--%>
                                                <%-- <%-- <c:if test="${not empty dataset.createTime}">

                                                  </c:if>--%>
                                        </td>

                                        <td >
                                            <ul id="icons" class="ui-widget ui-helper-clearfix">
                                                <li class="ui-state-default ui-corner-all" title="更新"><span class="ui-icon ui-icon-pencil"></span></li>
                                                <li class="ui-state-default ui-corner-all" title="删除"><span class="ui-icon ui-icon-trash"></span></li>
                                            </ul>
                                        </td>
                                    </tr>
                                </c:forEach>
                            </c:when>
                            <c:otherwise>
                                <tr>
                                    <td colspan="8" style="padding: 16px;font-size: 14px; font-family: '宋体'">无数据</td>
                                </tr>
                            </c:otherwise>
                        </c:choose>
                        </tbody>
                    </table>
                </div>


                <div>
                    <ul class="pagination" style="margin: 20px 30px;">
                        <li page="${requestScope.result.pageResult.startPage-1}">&laquo;</li>

                        <c:forEach begin="${requestScope.result.pageResult.startPage}"
                                   end="${requestScope.result.pageResult.endPage}" var="index">
                            <li page="${index}" <c:if
                                    test="${index==requestScope.result.pageResult.page}"> class="active" </c:if> >${index}
                            </li>
                        </c:forEach>

                        <li page="${requestScope.result.pageResult.endPage+1}">&raquo;</li>
                    </ul>
                </div>

            </div>

        </div>

        </div>



<jsp:include page="../../../commons/buttom.jsp"/>
</body>
</html>
